home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / inetutil.1 / inetutil / inetutils-1.1 / configure.in < prev    next >
Encoding:
Text File  |  1996-08-01  |  9.5 KB  |  314 lines

  1. # Process this file with autoconf to produce a configure script.
  2.  
  3. AC_INIT(inetd/inetd.c)
  4.  
  5. AC_CONFIG_HEADER(include/config.h:headers/config.h.in)
  6.  
  7. # These lists don't contain talk or talkd, which will get added later if nec.
  8. COMMON='libtelnet libinetutils'
  9. SERVERS='inetd ftpd telnetd rshd rlogind uucpd rexecd syslogd tftpd'
  10. CLIENTS='telnet ftp rsh rcp rlogin tftp syslog'
  11. AC_SUBST(COMMON)
  12. AC_SUBST(SERVERS)
  13. AC_SUBST(CLIENTS)
  14.  
  15. # All subdirectories, whether built or not
  16. SUBDIRS="headers $SERVERS $CLIENTS $COMMON"
  17. AC_SUBST(SUBDIRS)
  18.  
  19. # Optional things we put into libinetutils (we use the name `LIBOBJS' because
  20. # that's what AC_REPLACE_FUNCS uses).
  21. LIBOBJS=''
  22. AC_SUBST(LIBOBJS)
  23.  
  24. # Include files that we link into our own include directory from headers.
  25. # Initialize it with the things we always want to use.
  26. INCLUDES="version.h crypt.h arpa/telnet.h arpa/ftp.h arpa/tftp.h"
  27.  
  28. AC_ARG_ENABLE(encryption, [  --enable-encryption     enable encryption],
  29.           , enable_encryption=no)
  30. AC_ARG_ENABLE(authentication,
  31.           [  --enable-authentication enable connection authentication],
  32.           , enable_authentication=no)
  33. # By default we compile both servers and clients, but see what the user wants
  34. AC_ARG_ENABLE(servers, [  --disable-servers       don't compile servers],
  35.           , enable_servers=yes)
  36. AC_ARG_ENABLE(clients, [  --disable-clients       don't compile clients],
  37.           , enable_clients=yes)
  38.  
  39. AC_ARG_ENABLE(talk,    [  --disable-talk          don't compile talk or talkd],
  40.               , enable_talk=maybe)
  41.  
  42. AC_PROG_MAKE_SET
  43.  
  44. AC_PROG_CC
  45. AC_PROG_INSTALL
  46. AC_PROG_YACC
  47. AC_CHECK_TOOL(AR, ar)
  48. AC_CHECK_TOOL(RANLIB, ranlib, :)
  49. AC_PATH_PROG(RM, rm, rm)
  50.  
  51. AC_CHECK_HEADERS(malloc.h errno.h string.h stdarg.h termio.h termios.h \
  52.          stdlib.h sys/tty.h sys/utsname.h \
  53.          sys/msgbuf.h krb.h des.h netinet/in_systm.h \
  54.          netinet/ip.h netinet/ip_icmp.h netinet/ip_var.h vis.h \
  55.          sys/ioctl_compat.h sys/cdefs.h)
  56.  
  57. # Headers that we use our own version of if the system doesn't have them.
  58. AC_CHECK_HEADER(paths.h, , INCLUDES="$INCLUDES paths.h")
  59.  
  60. AC_CHECK_LIB(util, logout, LIBUTIL=-lutil)
  61. AC_SUBST(LIBUTIL)
  62. AC_CHECK_LIB(crypt, crypt, LIBCRYPT=-lcrypt)
  63. AC_SUBST(LIBCRYPT)
  64.  
  65. if test "$enable_encryption" = yes -o "$enable_authentication" = yes; then
  66.   AC_CHECK_LIB(krb, krb_mk_req, LIBAUTH=-lkrb)
  67.   AC_CHECK_LIB(des, des_key_sched, LIBAUTH="$LIBAUTH -ldes")
  68.   AC_SUBST(LIBAUTH)
  69. fi
  70.  
  71. _SAVE_LIBS="$LIBS"
  72. LIBS="$LIBUTIL $LIBS"
  73. AC_CHECK_FUNCS(cgetent uname strdup setutent_r logwtmp fpathconf tcgetattr crypt)
  74. LIBS="$_SAVE_LIBS"
  75.  
  76. # If there's no libtermcap, add a bogus version of tgetent to libinetutils,
  77. # as that's the only function actually used (except for dependencies from
  78. # curses).
  79. AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP=-ltermcap)
  80. if test "$ac_cv_lib_termcap_tgetent" = no; then
  81.   AC_CHECK_LIB(termlib, tgetent, LIBTERMCAP=-ltermlib)
  82. fi
  83. AC_SUBST(LIBTERMCAP)
  84.  
  85. if test -z "$LIBTERMCAP"; then
  86.   # Some packages include termcap just to check terminal type validity;
  87.   # for those cases, we really don't need termcap.
  88.   LIBOBJS="$LIBOBJS stub_tgetent.o"
  89. fi
  90.  
  91. # Only talk uses curses
  92. if test "$enable_talk" != no; then
  93.   _SAVE_LIBS="$LIBS"
  94.   LIBS="$LIBTERMCAP"
  95.   AC_CHECK_LIB(curses, initscr, LIBCURSES="-lcurses")
  96.   if test "$LIBCURSES" -a "$LIBTERMCAP"; then
  97.     AC_CACHE_CHECK(whether curses needs $LIBTERMCAP,
  98.            inetutils_cv_curses_needs_termcap,
  99.       LIBS="$LIBCURSES"
  100.       AC_TRY_LINK([#include <curses.h>], [initscr ();],
  101.           [inetutils_cv_curses_needs_termcap=no],
  102.           [inetutils_cv_curses_needs_termcap=yes]))
  103.   fi
  104.   LIBS="$_SAVE_LIBS"
  105. fi
  106. AC_SUBST(LIBCURSES)
  107.  
  108. AC_TYPE_SIGNAL
  109.  
  110. # Use `setpgid' if it's around, otherwise assume a BSD setpgrp
  111. AC_CHECK_FUNC(setpgid, , AC_DEFINE(setpgid, setpgrp))
  112.  
  113. if test "$enable_talk" = maybe; then
  114.   enable_talk=$ac_cv_lib_curses_initscr
  115. fi
  116.  
  117. AC_CACHE_CHECK(for EWOULDBLOCK in <errno.h>, inetutils_cv_macro_ewouldblock,
  118. AC_EGREP_CPP(HAVE_EWOULDBLOCK,
  119. [#include <errno.h>
  120. #ifdef EWOULDBLOCK
  121. HAVE_EWOULDBLOCK
  122. #endif],
  123.   [inetutils_cv_macro_ewouldblock=yes],
  124.   [inetutils_cv_macro_ewouldblock=no]))
  125. if test "$inetutils_cv_macro_ewouldblock" = no; then
  126.   AC_DEFINE(EWOULDBLOCK,EAGAIN)
  127. fi
  128.  
  129. AC_CACHE_CHECK(for __P, inetutils_cv_macro___p,
  130. AC_EGREP_CPP(HAVE___P,
  131. [#ifdef HAVE_SYS_CDEFS_H
  132. #include <sys/cdefs.h>
  133. #endif
  134. #ifdef __P
  135. HAVE___P
  136. #endif],
  137.   [inetutils_cv_macro___p=yes],
  138.   [inetutils_cv_macro___p=no]))
  139. if test "$inetutils_cv_macro___p" = yes; then
  140.   AC_DEFINE(HAVE___P)
  141. fi
  142.  
  143. # This can't just be a compile-check, as gcc somtimes accepts the syntax even
  144. # if feature isn't actually supported.
  145. AC_CACHE_CHECK(whether gcc weak references work,
  146.            inetutils_cv_weak_refs,
  147. AC_TRY_LINK([],
  148.   [extern char *not_defined (char *, char *) __attribute__ ((weak));
  149.    if (not_defined) puts ("yes"); ],
  150.   [inetutils_cv_weak_refs=yes],
  151.   [inetutils_cv_weak_refs=no]))
  152. if test "$inetutils_cv_weak_refs" = yes; then
  153.   AC_DEFINE(HAVE_WEAK_REFS)
  154. else
  155.   AC_CACHE_CHECK(whether pragma weak references work,
  156.          inetutils_cv_pragma_weak_refs,
  157.   AC_TRY_LINK([],
  158.     [extern char *not_defined (char *, char *);
  159. #pragma weak not_defined
  160.      if (not_defined) puts ("yes"); ],
  161.     [inetutils_cv_pragma_weak_refs=yes],
  162.     [inetutils_cv_pragma_weak_refs=no]))
  163.   if test "$inetutils_cv_pragma_weak_refs" = yes; then
  164.     AC_DEFINE(HAVE_PRAGMA_WEAK_REFS)
  165.   else
  166.     AC_CACHE_CHECK(whether asm weak references work,
  167.            inetutils_cv_asm_weak_refs,
  168.     AC_TRY_LINK([],
  169.       [extern char *not_defined (char *, char *);
  170.        asm (".weak not_defined");
  171.        if (not_defined) puts ("yes"); ],
  172.       [inetutils_cv_asm_weak_refs=yes],
  173.       [inetutils_cv_asm_weak_refs=no]))
  174.     if test "$inetutils_cv_asm_weak_refs" = yes; then
  175.       AC_DEFINE(HAVE_ASM_WEAK_REFS)
  176.     fi
  177.   fi
  178. fi
  179.  
  180. AC_CACHE_CHECK(whether struct stat has timespec fields,
  181.            inetutils_cv_struct_st_timespec,
  182. AC_TRY_COMPILE(
  183. [#include <sys/types.h>
  184. #include <sys/stat.h>],
  185.   [struct stat st; st.st_mtimespec.ts_nsec = 0;],
  186.   [inetutils_cv_struct_st_timespec=yes],
  187.   [inetutils_cv_struct_st_timespec=no]))
  188. if test "$inetutils_cv_struct_st_timespec" = yes; then
  189.   AC_DEFINE(HAVE___P)
  190. fi
  191.  
  192. if test "$inetutils_cv_struct_st_timespec" = yes; then
  193.   AC_DEFINE(HAVE_ST_TIMESPEC)
  194. else
  195.   AC_CACHE_CHECK(whether struct stat has time_usec fields,
  196.          inetutils_cv_struct_st_time_usec,
  197.   AC_TRY_COMPILE(
  198. [#include <sys/types.h>
  199. #include <sys/stat.h>],
  200.     [struct stat st; st.st_mtime_usec = 0;],
  201.     [inetutils_cv_struct_st_time_usec=yes],
  202.     [inetutils_cv_struct_st_time_usec=no]))
  203.  
  204.   if test "$inetutils_cv_struct_st_time_usec" = yes; then
  205.     AC_DEFINE(HAVE_ST_TIME_USEC)
  206.   fi
  207. fi
  208.  
  209. if test "$enable_talk" = yes; then
  210.   SERVERS="$SERVERS talkd"
  211.   CLIENTS="$CLIENTS talk"
  212.  
  213.   AC_CACHE_CHECK(for struct osockaddr in <sys/socket.h>,
  214.          inetutils_cv_struct_osockaddr,
  215.   AC_TRY_COMPILE(
  216. [#include <sys/types.h>
  217. #include <sys/socket.h>],
  218.     [struct osockaddr sa;],
  219.     [inetutils_cv_struct_osockaddr=yes],
  220.     [inetutils_cv_struct_osockaddr=no]))
  221.  
  222.   if test "$inetutils_cv_struct_osockaddr" = yes; then
  223.     AC_DEFINE(HAVE_OSOCKADDR)
  224.   else
  225.     # Use our own definition
  226.     INCLUDES="$INCLUDES osockaddr.h"
  227.   fi
  228. fi
  229. # Update SUBDIRS regardless
  230. SUBDIRS="$SUBDIRS talkd talk"
  231.  
  232. SERVERS_OR_CLIENTS=
  233. if test "$enable_servers" = yes; then
  234.   SERVERS_OR_CLIENTS="$SERVERS"
  235. fi
  236. if test "$enable_clients" = yes; then
  237.   SERVERS_OR_CLIENTS="$SERVERS_OR_CLIENTS $CLIENTS"
  238. fi
  239. AC_SUBST(SERVERS_OR_CLIENTS)
  240.  
  241. if test "$enable_authentication" = yes; then
  242.   AC_DEFINE(AUTHENTICATION)
  243. fi
  244. if test "$enable_encryption" = yes; then
  245.   AC_DEFINE(ENCRYPTION)
  246. fi
  247.  
  248. if test "$enable_authentication" = yes -a "$ac_cv_lib_krb_krb_mk_req" = yes; then
  249.   AC_DEFINE(KRB4)
  250. fi
  251. if test "$enable_encryption" = yes -a "$ac_cv_lib_des_des_key_sched" = yes; then
  252.   AC_DEFINE(DES_ENCRYPTION)
  253. fi
  254.  
  255. # We use our own version of getopt if the system one doesn't have getopt_long
  256. AC_CHECK_FUNC(getopt_long, ,
  257.   INCLUDES="$INCLUDES getopt.h"
  258.   LIBOBJS="$LIBOBJS getopt.o getopt1.o")
  259.  
  260. # Supply versions of the BSD error reporting functions if the system doesn't
  261. AC_CHECK_FUNC(verrx, ,
  262.   INCLUDES="$INCLUDES err.h"
  263.   LIBOBJS="$LIBOBJS err.o")
  264.  
  265. # See if the system has strerror, and replace it if not
  266. AC_CHECK_FUNC(strerror, , LIBOBJS="$LIBOBJS strerror.o")
  267. if test "$ac_cv_func_strerror" = no; then
  268.   # No strerror, so see if the SYS_ERRLIST variable can be used by ours
  269.   AC_CHECK_FUNC(sys_errlist)
  270.   if test "$ac_cv_func_sys_errlist" = yes; then
  271.     AC_CACHE_CHECK(whether sys_errlist is declared,
  272.             inetutils_cv_sys_errlist_decl,
  273.     AC_TRY_COMPILE(
  274. [#include <stdio.h>
  275. #ifdef HAVE_ERRNO_H
  276. #include <errno.h>
  277. #endif],
  278.       [char *x = sys_errlist[sys_nerrs - 1];],
  279.       [inetutils_cv_sys_errlist_decl=yes],
  280.       [inetutils_cv_sys_errlist_decl=no]))
  281.     if test "$inetutils_cv_sys_errlist_decl" = yes; then
  282.       AC_DEFINE(HAVE_SYS_ERRLIST_DECL)
  283.     fi
  284.   fi
  285. fi
  286.  
  287. AC_CACHE_CHECK(for sig_t, inetutils_cv_type_sig_t,
  288.   AC_TRY_COMPILE(
  289. [#include <sys/types.h>
  290. #include <signal.h>],
  291.     [sig_t foo;],
  292.     [inetutils_cv_type_sig_t=yes], [inetutils_cv_type_sig_t=no]))
  293. if test "$inetutils_cv_type_sig_t" = yes; then
  294.   AC_DEFINE(HAVE_SIG_T)
  295. fi
  296.  
  297. # See if the __PROGNAME variable is defined, otherwise use our own.
  298. AC_CHECK_FUNC(__progname,
  299.   AC_DEFINE(HAVE___PROGNAME),
  300.   LIBOBJS="$LIBOBJS __progname.o")
  301.  
  302. # See if snprintf exists, otherwise just use a bogus version
  303. AC_CHECK_FUNC(snprintf,
  304.   AC_DEFINE(HAVE_SNPRINTF),
  305.   LIBOBJS="$LIBOBJS snprintf.o")
  306.  
  307. # Supply optional header files by linking a copy into the object include dir
  308. _ISRCS="`for I in $INCLUDES; do echo $ac_n ' 'headers/$I$ac_c; done`"
  309. _IDSTS="`for I in $INCLUDES; do echo $ac_n ' 'include/$I$ac_c; done`"
  310. AC_LINK_FILES($_ISRCS, $_IDSTS)
  311.  
  312. SUBDIR_MAKEFILES="`for D in $SUBDIRS; do echo $ac_n ' '$D/Makefile$ac_c; done`"
  313. AC_OUTPUT(Makefile config.make $SUBDIR_MAKEFILES)
  314.